console.log("加载init.js");
//初始化app
var myApp = new Framework7({
    modalTitle: '哇吖旅行',
    modalButtonOk: '知道了',
    animateNavBackIcon: true,
    precompileTemplates: true,
    template7Pages: true,
});

//初始化view 
var mainView = myApp.addView('.view-main', {
	  dynamicNavbar: true
});

//开启loader
myApp.showIndicator();

// Export selectors engine
var $$ = Dom7;
var base_url = "http://m.wayatrip.com/test/";

var url_get_city = "http://api.wayatrip.com/city/getcity";
var url_get_selfplayingmethodtype = "http://api.wayatrip.com/ziying/gettype";
var url_get_selfplayingmethodlist = "http://api.wayatrip.com/ziying/getlist";
var url_get_selfplaydetaildesc = "http://api.wayatrip.com/ziying/getDesc";
var url_get_selfplayingmethoddetail = "http://api.wayatrip.com/ziying/detail";

var url_get_design_trip_anli_index="http://api.wayatrip.com/designtrip/anli_index";
var url_get_design_trip_anli_detail="http://api.wayatrip.com/designtrip/anli_detail";


//预编译模板
myApp.playSelfItemTemplate = Template7.compile($$('script#PlaySelfItem').html());
myApp.playingmethodtypeTemplate = Template7.compile($$('script#PlayingMethodType').html());
myApp.playingMethodCityTemplate = Template7.compile($$('script#PlayingMethodCity').html());
myApp.selfPlayDescLineTemplate = Template7.compile($$('script#SelfPlayDescLine').html());
myApp.selfPlayDescPriceTemplate = Template7.compile($$('script#SelfPlayDescPrice').html());
myApp.playSelfTripDayTemplate = Template7.compile($$('script#SelfPlayTripDay').html());

myApp.designTripAnliIndexTemplate = Template7.compile($$('script#anli_index').html());
myApp.designTripAnliDetailTemplate = Template7.compile($$('script#anli_detail').html());

//注册模板辅助函数
Template7.registerHelper('selfplayingmethoddetailrecommend_format', function (recommend) {
    var result='';
    if(recommend){
        var recommendlist = recommend.split("\n");
        for(var i in recommendlist){
            result = result + "<li class='selfplay-recommend-li'>"
            +"<div class='recommend-icon'><img src='img/thumb-42.png' style='width:25px;'></div>"
            +"<div class='recommend-text'>"+recommendlist[i] +"</div></li>";
        }
    }
    return result;
});